class BaseTextField extends egret.TextField
{
    constructor(){
        super();
        this.fontFamily = '微软雅黑';
    }

    private _strWidth:number; // 获取字符串实际宽度
    public get strWidth():number{
        this.calLabel.size = this.size;
        this.calLabel.bold = this.bold;
        this.calLabel.stroke = this.stroke;
        this.calLabel.italic = this.italic;
        this.calLabel.textFlow = this.textFlow;
        this.calLabel.maxChars = this.maxChars;
        this.calLabel.text = this.text;
        this.calLabel.height = this.height;
        this._strWidth = this.calLabel.width;
        return this._strWidth;
    }

    /*********************************************** private **********************************************************/
    // 用于计算宽度的参照
    private _calLabel:BaseTextField;
    private get calLabel():BaseTextField{
        if(!this._calLabel){
            var calLabel = new BaseTextField();
            this._calLabel = calLabel;
        }
        return this._calLabel;
    }


}